<%@ Page language="c#" MasterPageFile="Admin.master" Codebehind="Groups.aspx.cs" AutoEventWireup="True" Inherits="CrossFactory.SiteNote.Admin.Groups" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="ajaxToolkit" %>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<script language="javascript">
    function getGroupName() {
        return document.getElementById('<%= lstGroups.ClientID %>').value;
    }
</script>
<table style="margin-left:20px;">
    <tr>
        <td>
            <table>
                <tr>
                    <td>
                        <table cellpadding="0" cellspacing="0" width="300">
                            <tr>
                                <td id="Td2">
                                    <table id="Table2" class="ms-toolbar" cellspacing="0" cellpadding="2" border="0">
                                        <tr id="Tr2">
                                            <td id="Td4">
                                                <table id="Table3" cellspacing="0" cellpadding="2" border="0">
                                                    <tr id="Tr3">
                                                        <td id="Td5" class="ms-toolbar">
                                                            Groups :
                                                        </td>
                                                    </tr>
                                                </table>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:ListBox id="lstGroups" runat="server" width="300px" CssClass="cmtext" Rows="10" AutoPostBack="True" onselectedindexchanged="lstGroups_SelectedIndexChanged"></asp:ListBox>
                    </td>
                </tr>
                <tr>
                    <td style="padding-top:10px" align="right">
                        <asp:Button id="cmdCreateGroup" runat="server" Text="Add new" CssClass="cmtext" onclick="cmdCreateGroup_Click"></asp:Button>
						<asp:Button id="cmdDeleteGroup" runat="server" Text="Delete" CssClass="cmtext" OnClientClick="return ConfirmAction('Are you sure you want to delete the group ' + getGroupName() + '?');" onclick="cmdDeleteGroup_Click"></asp:Button>
						<asp:Button id="cmdModifyGroup" runat="server" Text="Modify" CssClass="cmtext" onclick="cmdModifyGroup_Click"></asp:Button>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td style="padding-left:5px;padding-top:10px;padding-bottom:10px;">
            <asp:Panel id="groupPanel" runat="server" Visible="False">
                <table cellSpacing="0" cellPadding="0" width="100%" border="0" style="font-family:Verdana,Arial;">
				    <tr>
				        <td colspan="3" style="padding-bottom:5px;">
				            <table cellpadding="0" cellspacing="0" style="padding:5px;">
				                <tr>
				                    <td class="usersGroupsAdminLabels">Name :</td>
				                    <td style="background-color:#D8E4F5">
					                    <asp:TextBox id="txtGroupName" runat="server" BorderStyle="Solid" CssClass="cmtextbox" BorderWidth="1px" BorderColor="#84B2EF" width="200px"></asp:TextBox>
				                    </td>
				                    <td>
				                        <asp:RequiredFieldValidator ID="vldGroupName" runat="server" ControlToValidate="txtGroupName" ErrorMessage="Group name must be specified" />
					                    <asp:RegularExpressionValidator id="RegularExpressionValidator1" runat="server" CssClass="cmtextvalidation" ErrorMessage="*" ControlToValidate="txtGroupName"
						                    ValidationExpression="[\w\b-/.]+"></asp:RegularExpressionValidator>
				                    </td>
				                </tr>
				            </table>
				        </td>
				    </tr>
				    <tr>
				        <td align="left">
				            <table cellpadding="0" cellspacing="0">
				                <tr>
				                    <td>
				                        <table cellpadding="0" cellspacing="0" width="300">
                                            <tr>
                                                <td id="Td1">
                                                    <table id="Table1" class="ms-toolbar" cellspacing="0" cellpadding="2" border="0">
                                                        <tr id="Tr1">
                                                            <td id="Td3">
                                                                <table id="Table4" cellspacing="0" cellpadding="2" border="0">
                                                                    <tr id="Tr4">
                                                                        <td id="Td6" class="ms-toolbar">
                                                                            Users :
                                                                        </td>
                                                                    </tr>
                                                                </table>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </td>
                                            </tr>
                                        </table>
				                    </td>
				                </tr>
				                <tr>
				                    <td style="padding-top:5px;">
				                        <asp:TextBox ID="TextBoxSearch" runat="server" Width="300" Visible="false"></asp:TextBox>
                                        <ajaxToolkit:AutoCompleteExtender 
                                            runat="server" 
                                            ID="AutoComplete1" 
                                            TargetControlID="TextBoxSearch"
                                            ServiceMethod="GetCompletionListUserName"
                                            ServicePath="Webservices/AutoComplete.asmx"
                                            MinimumPrefixLength="2" 
                                            CompletionInterval="500"
                                            EnableCaching="true"
                                            CompletionSetCount="8" 
                                            CompletionListCssClass="autocomplete_completionListElement" 
                                            CompletionListItemCssClass="autocomplete_listItem" 
                                            CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem"
                                            >
                                        </ajaxToolkit:AutoCompleteExtender>
										<asp:ListBox id="lstUsers" runat="server" CssClass="cmtext" width="300px" Rows="10" SelectionMode="Multiple"></asp:ListBox>
				                    </td>
				                </tr>
				            </table>
				        </td>
				        <td style="width:75px;" align="center">
				            <!-- BOUTONS -->
				            <asp:Button id="btnGroupIn" runat="server" CssClass="cmtext" Text="-->" CausesValidation=false onclick="btnGroupIn_Click"></asp:Button><br /><br />
							<asp:Button id="btnGroupOut" runat="server" CssClass="cmtext" Text="<--" CausesValidation=false onclick="btnGroupOut_Click"></asp:Button>
				        </td>
				        <td align="left">
				            <table>
				                <tr>
				                    <td>
				                        <table cellpadding="0" cellspacing="0" width="300">
                                            <tr>
                                                <td id="Td7">
                                                    <table id="Table5" class="ms-toolbar" cellspacing="0" cellpadding="2" border="0">
                                                        <tr id="Tr5">
                                                            <td id="Td8">
                                                                <table id="Table6" cellspacing="0" cellpadding="2" border="0">
                                                                    <tr id="Tr6">
                                                                        <td id="Td9" class="ms-toolbar">
                                                                            Users in group :
                                                                        </td>
                                                                    </tr>
                                                                </table>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </td>
                                            </tr>
                                        </table>
				                    </td>
				                </tr>
				                <tr>
				                    <td>
				                        <asp:ListBox id="lstUsersGroup" runat="server" CssClass="cmtext" width="300px" Rows="10" SelectionMode="Multiple"></asp:ListBox>
				                    </td>
				                </tr>
				            </table>
				        </td>
				    </tr>
				    <tr>
				        <td colspan="3" style="padding-top:10px" align="right">
                            <asp:Button id="cmdInsertGroup" runat="server" CssClass="cmtext" Text="Save" onclick="cmdInsertGroup_Click"></asp:Button>
                            <asp:Button id="cmdUpdateGroup" runat="server" CssClass="cmtext" Text="Update" onclick="cmdUpdateGroup_Click"></asp:Button>
                            <asp:Button id="cmdCancel" runat="server" CssClass="cmtext" Text="Cancel" CausesValidation="false" onclick="cmdCancel_Click"></asp:Button>
				        </td>
				    </tr>
			    </table>
			</asp:Panel>
        </td>
    </tr>
    <tr>
	    <td>
		    <asp:Label id="lblError" runat="server" Visible="False" CssClass="cmtext"></asp:Label>
		</td>
	</tr>
</table>
</asp:Content>